add deterministic methods and increase test coverage#35
Merged
Conversation
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
filintod
commented
Nov 14, 2025
| coverage-clean: | ||
| rm -f .coverage .coverage.* coverage.xml | ||
|
|
||
| coverage-all: coverage-clean |
Author
There was a problem hiding this comment.
could probably later be moved to tox as a new test option
Member
There was a problem hiding this comment.
Could it be moved now? Or maybe open a separate PR for it?
Author
|
@acroca ptal |
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
filintod
commented
Nov 14, 2025
| @@ -0,0 +1,74 @@ | |||
| from collections import namedtuple | |||
Author
There was a problem hiding this comment.
cover paths not tested previously, and can be used in the future when we add pydantic/others
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
sicoyle
approved these changes
Nov 17, 2025
sicoyle
left a comment
There was a problem hiding this comment.
overall LGTM, few comments/questions
Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
d633481 to
e149057
Compare
acroca
reviewed
Nov 18, 2025
| coverage-clean: | ||
| rm -f .coverage .coverage.* coverage.xml | ||
|
|
||
| coverage-all: coverage-clean |
Member
There was a problem hiding this comment.
Could it be moved now? Or maybe open a separate PR for it?
Comment on lines
+751
to
+775
| def test_can_add_functions_after_stop(): | ||
| """Test that orchestrators/activities can be added after stopping the worker.""" | ||
|
|
||
| def orchestrator1(ctx: task.OrchestrationContext, _): | ||
| return "done" | ||
|
|
||
| def orchestrator2(ctx: task.OrchestrationContext, _): | ||
| return "done2" | ||
|
|
||
| def activity(ctx: task.ActivityContext, input): | ||
| return input | ||
|
|
||
| with worker.TaskHubGrpcWorker(stop_timeout=2.0) as w: | ||
| w.add_orchestrator(orchestrator1) | ||
| w.start() | ||
|
|
||
| c = client.TaskHubGrpcClient() | ||
| id = c.schedule_new_orchestration(orchestrator1) | ||
| state = c.wait_for_orchestration_completion(id, timeout=30) | ||
| assert state is not None | ||
| assert state.runtime_status == client.OrchestrationStatus.COMPLETED | ||
|
|
||
| # Should be able to add after stop | ||
| w.add_orchestrator(orchestrator2) | ||
| w.add_activity(activity) |
Member
There was a problem hiding this comment.
hm, what's the point of adding after stopping?
Author
There was a problem hiding this comment.
testing that you can stop add start if wanted
Co-authored-by: Albert Callarisa <albert@acroca.com> Signed-off-by: Filinto Duran <1373693+filintod@users.noreply.github.com>
acroca
approved these changes
Nov 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also from asyncio big PR, adding deterministic methods that are shared between sync/async context. Also increase test coverage of some previously not tested paths
current coverage: